<template>
  <div class="layoutContainer">
    <div class="layoutHeader">
      <minHeader
        :menusStructure="
          isTeacher() ? state.menusStructure : state.studentMenusStructure
        "
      />
    </div>
    <div class="layoutWrapper">
      <StarBackground />
      <div class="layoutContent">
        <router-view v-slot="{ Component }">
          <keep-alive>
            <component
              :is="Component"
              :key="route.fullPath"
              v-if="route?.meta?.keepAlive"
            />
          </keep-alive>
          <component
            :is="Component"
            :key="route?.fullPath"
            v-if="!route?.meta?.keepAlive"
          />
        </router-view>
      </div>
    </div>
  </div>
</template>

<script setup>
import StarBackground from '@/components/StarBackground.vue'
import minHeader from '@/components/common/minHeader.vue'
import { reactive, ref, watch, h } from 'vue'
import { state, isTeacher } from '@/stores/info.js'
import { useRoute, useRouter } from 'vue-router'
const route = useRoute()
</script>

<style lang="scss" scoped>
* {
  box-sizing: border-box;
  min-height: 0;
  min-width: 0;
}
.layoutContainer {
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  min-width: 0;
  .layoutHeader {
    width: 100%;
    display: flex;
    justify-content: center;
    background: #fff;
    .header {
      width: $viewMinWidth;
    }
  }
  .layoutWrapper {
    min-height: 0;
    min-width: 0;
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    .layoutContent {
      flex: 1;
      width: $viewMinWidth;
      display: flex;
      justify-content: space-between;
    }
  }
}
</style>
